#include "principal.h"
#include <QApplication>
#include <conexion.h>
#include <QStyleFactory>
#include <QStyle>
#include <QDesktopWidget>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    conexion();
    a.setStyle(QStyleFactory::create("Fusion"));


    QPalette darkPalette;
//    darkPalette.setColor(QPalette::Window, QColor(235,235,235));
    darkPalette.setColor(QPalette::WindowText, Qt::black);
    //darkPalette.setColor(QPalette::Base, QColor(255,255,255));,
    //darkPalette.setColor(QPalette::AlternateBase, QColor(240,240,240));
//    darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
//    darkPalette.setColor(QPalette::ToolTipText, Qt::darkGray);
    darkPalette.setColor(QPalette::Text, Qt::black);
//    // darkPalette.setColor(QPalette::Button, QColor(53,53,53));
//    //darkPalette.setColor(QPalette::ButtonText, Qt::white);
//    darkPalette.setColor(QPalette::BrightText, Qt::red);
//    darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
    darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
//    darkPalette.setColor(QPalette::HighlightedText, Qt::white);

//    a.setPalette(darkPalette);

    //      a.setStyleSheet(// "QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"
    //                         "QTableView{selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f0f9ff, stop: 0.47 #cbebff, stop: 1 #a1dbff);}"
    //                        "QPushButton::hover{background-color : LightGray }"
    //                        "QLineEdit[enabled=false]{border : 2px solid gray}"
    //                        "QLineEdit{border-radius : 3px}");
    //                          "QHeaderView::section{color : lightblue}");

    // TODO:make something
    a.setStyleSheet("QMainWindow, QDialog{background :#F8F8FF}"
                    "QPushButton{min-width : 80px; padding : 0px 2px 0px 2px; min-width : 50px;border-radius : 3px; min-height : 25px;background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fcfcfc, stop: 0.5 #f1f1f1, stop: 0.51 #e1e1e1, stop: 1 #f6f6f6); border: 1px solid lightBlue;}"
                    "QToolButton{background :qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fcfcfc, stop: 0.5 #f1f1f1, stop: 0.51 #e1e1e1, stop: 1 #f6f6f6); border: 1px solid lightBlue;}"
                    "QToolButton:hover{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 0.5 #f9f9f9, stop: 0.51 #ffffff, stop: 1 #ffffff);}"
                    "QPushButton::hover{padding : 0px 2px 0px 2px; min-width : 50px;border-radius : 3px; min-height : 25px; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 0.5 #f9f9f9, stop: 0.51 #ffffff, stop: 1 #ffffff);}"
                    "QPushButton:flat, QDialog QPushButton:flat{border:none;background: rgba( 255, 255, 255, 0% );}"
                    "QComboBox QAbstractItemView { background :white;border: 2px solid CornflowerBlue ; border-radius : 3px;"
                    "selection-background-color: DodgerBlue;}"
                    "QScrollBar:horizontal{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f6f8f9, stop: 0.5 #e5ebee, stop: 0.51 #d7dee3, stop: 1 #f5f7f9);}"
                    "QScrollBar:vertical{background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #f6f8f9, stop: 0.5 #e5ebee, stop: 0.51 #d7dee3, stop: 1 #f5f7f9);}"
                    "QScrollBar::handle:horizontal{;min-width : 20px;margin : 0px 13px 0px 13px;border : 1px solid CornFlowerBlue; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ebf1f6, stop: 0.5 #abd3ee, stop: 0.51 #89c3eb, stop: 1 #d5ebfb); border-radius : 2px}"
                    "QScrollBar::handle:vertical{min-height : 20px; margin : 13px 0px 13px 0px;border : 1px solid CornFlowerBlue;background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ebf1f6, stop: 0.5 #abd3ee, stop: 0.51 #89c3eb, stop: 1 #d5ebfb); border-radius : 2px}"
                    "QTableView, QTableWidget{font-size: 11.2px; selection-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(183,222,237,1), stop: 0.5 rgba(113,206,239,1), stop: 0.51 rgba(33,180,226,1), stop: 1 rgba(183,222,237,1));;alternate-background-color : #F0F8FF}"
                    "QHeaderView::section{background : white; color : darkslategray; font : bold}"
                    "QWidget#qt_calendar_navigationbar {background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(183,222,237,1), stop: 0.5 rgba(113,206,239,1), stop: 0.51 rgba(33,180,226,1), stop: 1 rgba(183,222,237,1))}"
                    "QWidget#qt_calendar_navigationbar QToolButton {background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(183,222,237,1), stop: 0.5 rgba(113,206,239,1), stop: 0.51 rgba(33,180,226,1), stop: 1 rgba(183,222,237,1)); height:15px; border:none}"
                    "QWidget#qt_calendar_calendarview {border : 1px solid LightBlue }"
                    "QWidget#qt_calendar_navigationbar QToolButton::menu-indicator{top:10px; left: 10px;}"
                    "QWidget#qt_calendar_navigationbar QToolButton:hover{color:Lavender }"
                    "QToolTip { font-size : 13px;color: #2a82da; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fcfcfc, stop: 0.5 #f1f1f1, stop: 0.51 #e1e1e1, stop: 1 #f6f6f6); border: 1px solid lightBlue;}"
                    );


    Principal w;
    w.setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,w.size(),a.desktop()->availableGeometry()));
    w.show();

    return a.exec();
}
